public class Arraytest {
    public static void main(String[] args) {
        //动态初始化数组
        int sum = 0;
        int[] a = new int[10];

        for (int i = 0; i < a.length; i++) {
            System.out.println(i + ":" + a[i]);
        }
        for (int i = 0; i < a.length; i++) {
            a[i] = i;
            sum += a[i];
        }

        System.out.println(sum);
    }

}
